import request from '@/utils/request'
/**
 * @description 获取员工列表
 * @param {Object} params {page:页码  size:条数}
 * @returns Primose
 */
export function  getAllEmployeeAPI(params) {
    return request({
        url:'/sys/user',
        method:'GET',
        params
    })
}

/**
 * @description 新增员工
 * @param {Object} data 
 * @returns 
 */
export function createEmployeeAPI(data) {
    return request({
        url:'/sys/user',
        method:'POST',
        data
    })
}


/**
 * @description 批量excel导入员工
 * @param {Object} data 
 * @returns 
 */
export function batchImportEmployeeAPI(data) {
    return request({
        url:'/sys/user/batch',
        method:'POST',
        data
    })
}

/**
 * @description 删除员工
 * @param {String} id 
 * @returns 
 */
export function deleteEmployeeAPI(id) {
    return request({
        url:`/sys/user/${id}`,
        method:'DELETE',
    })
}

/**
 * @description 获取员工基本信息
 * @param {String} id 员工id
 * @returns Primose
 */
export function  getEmployeeBasicInfoAPI(id) {
    return request({
        url:`/sys/user/${id}`,
        method:'GET',
    })
}
/**
 * @description 更新员工基本信息
 * @param {Object} data 
 * @returns Primose
 */
export function  updateEmployeeBasicInfoAPI(data) {
    return request({
        url:`/sys/user/${data.id}`,
        method:'PUT',
        data
    })
}
/**
 * @description 获取员工个人信息
 * @param {String} id 员工id
 * @returns Primose
 */
export function  getEmployeeInfoAPI(id) {
    return request({
        url:`/employees/${id}/personalInfo`,
        method:'GET'
    })
}
/**
 * @description 更新员工个人信息
 * @param {Object} data
 * @returns Primose
 */
export function  updateEmployeeInfoAPI(data) {
    return request({
        url:`/employees/${data._id}/personalInfo`,
        method:'PUT',
        data
    })
}

/**
 * @description 获取员工岗位信息
 * @param {String} id
 * @returns Primose
 */
export function getEmployeeJobInfoAPI(id) {
    return request({
        url:`/employees/${id}/jobs`,
        method:'GET'
    })
}
/**
 * @description 更新员工岗位信息
 * @param {Object} data
 * @returns Primose
 */
export function updateEmployeeJobInfoAPI(data) {
    return request({
        url:`/employees/${data.userId}/jobs`,
        method:'PUT',
        data
    })
}

/**
 * @description 员工分配角色
 * @param {Object} data
 * @returns Primose
 */
export function assignEmployeeRoleAPI(data) {
    return request({
        url:'/sys/user/assignRoles',
        method:'PUT',
        data
    })
}